<template>
  <div class="container">
    <salaryTopTitle
      @gobackTriser="goBack"
      v-if="wherePage == 'fj'"
      :salaryOperate="salaryOperate"
      :salaryExcel="salaryExcel"
    ></salaryTopTitle>
    <salaryTopTitle @gobackTriser="goBack" v-else></salaryTopTitle>
    <!--制作方式-->
    <div class="mainCon">
      <createSalaryStep :activeIndex="activeIndex"></createSalaryStep>
      <div class="createWayBox" id="createWayBox">
        <p>请选择工资代发方式</p>
        <div v-if="!ONLINE && !OFFLINE && isFj">
          <p>
            <i class="el-icon-warning icontip"></i>
          </p>
          {{ tipMsg }}
        </div>
        <ul class="clearfix" v-if="isFj">
          <!-- 非建端代发方式 - 先上代发 -->
          <li class="freeBox" v-if="ONLINE">
            <div>
              <div class="title">
                <span class="way fontColorTheme">线上代发</span>
              </div>

              <div class="explainBox">
                <span>需线上授权银行发放工资</span>
              </div>
              <div>
                <el-button
                  class="commonBut saveBtn"
                  @click="fjToReportSalary"
                  v-sdc
                  >上报工资表</el-button
                >
              </div>
            </div>
          </li>
          <!-- 非建端代发方式 - 线下代发 -->
          <li class="freeBox" v-if="OFFLINE">
            <div>
              <div class="title">
                <span class="way fontColorTheme">线下授权</span>
              </div>

              <div class="explainBox">
                <span>需携带相关资料前往银行授权发放工资</span>
              </div>
              <div>
                <el-button
                  class="commonBut saveBtn"
                  @click="fjToReportofflinePay"
                  v-sdc
                  >上报工资表</el-button
                >
              </div>
            </div>
          </li>
          <li v-if="false">
            <div>
              <div class="title">
                <span class="way fontColorTheme">银联代发</span>
              </div>
              <div class="explainBox">
                <span
                  >在线代发工资， 代发手续费由银联收取，平台不收取任何费用</span
                >
                <br />
                <span>
                  <i class="icon iconfont iconwenti"></i>本次手续费
                  <span class="red">￥{{ paypoundage.total }}</span>
                  <el-popover
                    placement="top-start"
                    title="手续费"
                    width="300"
                    trigger="hover"
                  >
                    <ul class="serviceChargeDetail">
                      <li>
                        预收代发手续费：
                        <span
                          >￥ {{ paypoundage.poundageIssue }}*{{
                            paypoundage.peopleCount
                          }}
                          人</span
                        >
                      </li>
                      <li>
                        银联支付手续费：
                        <span>￥ {{ paypoundage.poundagePay }}</span>
                      </li>
                    </ul>
                    <el-link type="primary" slot="reference">查看详情</el-link>
                  </el-popover>
                </span>
              </div>
              <div>
                <el-button class="commonBut saveBtn" @click="isPay"
                  >上报工资表</el-button
                >
              </div>
            </div>
          </li>
        </ul>
        <ul class="clearfix" v-else>
          <li v-if="offerType">
            <div>
              <div class="title">
                <span class="way fontColorTheme">普通代发</span>
              </div>

              <div class="explainBox">
                <span>需授权银行发放工资</span>
              </div>
              <div>
                <el-button class="commonBut saveBtn" @click="toReportSalary"
                  >上报工资表</el-button
                >
              </div>
            </div>
          </li>
          <li v-if="onlineType">
            <div>
              <div class="title">
                <span class="way fontColorTheme">线上代发</span>
              </div>

              <div class="explainBox">
                <span>需线上授权银行发放工资</span>
              </div>
              <div>
                <el-button class="commonBut saveBtn" @click="onlineAgencyBtn"
                  >上报工资表</el-button
                >
              </div>
            </div>
          </li>
          <li v-if="offlineType">
            <div>
              <div class="title">
                <span class="way fontColorTheme">线下授权</span>
              </div>
              <div class="explainBox">
                <span>需携带相关资料前往银行授权发放工资</span>
              </div>
              <div>
                <el-button
                  class="commonBut saveBtn"
                  @click="toReportofflinePay"
                  :disabled="isDisable"
                  >上报工资表</el-button
                >
              </div>
            </div>
          </li>
          <li v-if="false">
            <div>
              <div class="title">
                <span class="way fontColorTheme">银联代发</span>
              </div>

              <div class="explainBox">
                <span
                  >在线代发工资， 代发手续费由银联收取，平台不收取任何费用</span
                >
                <br />
                <span>
                  <i class="icon iconfont iconwenti"></i>本次手续费
                  <span class="red">￥{{ paypoundage.total }}</span>
                  <el-popover
                    placement="top-start"
                    title="手续费"
                    width="300"
                    trigger="hover"
                  >
                    <ul class="serviceChargeDetail">
                      <li>
                        预收代发手续费：
                        <span
                          >￥ {{ paypoundage.poundageIssue }}*{{
                            paypoundage.peopleCount
                          }}
                          人</span
                        >
                      </li>
                      <li>
                        银联支付手续费：
                        <span>￥ {{ paypoundage.poundagePay }}</span>
                      </li>
                    </ul>
                    <el-link type="primary" slot="reference">查看详情</el-link>
                  </el-popover>
                </span>
              </div>
              <div>
                <el-button class="commonBut saveBtn" @click="isPay"
                  >上报工资表</el-button
                >
              </div>
            </div>
          </li>
        </ul>
        <div class="btnContainer">
          <el-button class="commonBut" @click="toSalaryList"
            >返回工资表管理</el-button
          >
        </div>
      </div>
    </div>
    <!-- 可足额支付工资款项线上代发模态框 -->
    <el-dialog
      :visible.sync="centerDialogVisible"
      width="30%"
      center
      :showClose="false"
      :modal-append-to-body="false"
      :append-to-body="true"
    >
      <div slot="title"></div>
      <div class="successContent">
        <i class="el-icon-success successIcon"></i>
        <p class="payAbleList">
          工资表应发总人数为
          <span>{{ onlineAgencyDate.shouldCount }}人</span>,
          工资表应发工资总额为 <span>{{ onlineAgencyDate.shouldPay }}元</span>,
        </p>
        <p class="accountBalance">
          专户余额为
          <span>{{ onlineAgencyDate.balance }}元</span>,
        </p>
        <p class="accountBalance-tip">可足额支付工资款项</p>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false" class="cancel"
          >关闭</el-button
        >
        <el-button
          type="primary"
          @click="toAuthorize"
          class="save"
          :loading="canLogin"
          v-sdc
          >去授权代发</el-button
        >
      </div>
    </el-dialog>
    <!-- 无法支付工资款项线上代发模态框 -->
    <el-dialog
      :visible.sync="noDialogVisible"
      width="30%"
      center
      :showClose="false"
      :modal-append-to-body="false"
      :append-to-body="true"
    >
      <div slot="title"></div>
      <div class="successContent">
        <i class="el-icon-warning warningIcon"></i>
        <p class="payAbleList">
          工资表应发总人数为
          <span>{{ onlineAgencyDate.shouldCount }}人</span>,
          工资表应发工资总额为 <span>{{ onlineAgencyDate.shouldPay }}元</span>,
        </p>
        <p class="accountBalance">
          专户余额为
          <span style="color: #ffaa00">{{ onlineAgencyDate.balance }}元</span>,
        </p>
        <p class="balance-tip">
          无可足额支付工资款项，请足额缴存后，继续使用本系统发放工资。
        </p>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="noDialogVisible = false" class="cancel"
          >关闭</el-button
        >
        <el-button type="primary" @click="toSalaryList" class="save"
          >返回工资表管理</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import createSalaryStep from '@/components/publicCom/createSalaryStepJz'
import salaryTopTitle from '@/components/publicCom/salaryTopTitle'

export default {
  name: 'createSalaryWay',
  components: {
    createSalaryStep,
    salaryTopTitle,
  },
  data() {
    return {
      centerDialogVisible: false,
      isDisable: false,
      noDialogVisible: false,
      onlineAgencyDate: '',
      activeIndex: 3,
      importBtn: false, //导入工资表
      makeSalaryBtn: false, //制作工资表
      id: '',
      sequenceCode: '',
      year: '',
      month: '',
      type: '',
      paypoundage: '',
      projectId: '',
      projectName: '',
      // isShowBank: false,
      wherePage: '',
      tipMsg: '你开设的专户所在银行未提供任何代发方式,请联系当地劳动监察部门。',
      salaryOperate: 'salaryOperate', //非建工资下载
      salaryExcel: 'salaryExcel', //非建工资模板
      showXianshang: false, //隐藏线上代发
      ONLINE: false, //线上代发方式 2020-11-18
      OFFLINE: false, //线下代发方式 2020-11-18
      isFj: false, //非建代发

      // 光谷信息
      offerType: false, //报盘代发
      onlineType: false, //线上代发
      offlineType: false, //线下代发
      batchNo: '', //工资批次
      checkOperator: '', //审核开启人存在施工方建设方审核或劳动监察审核开启时提示
      reportStatus: '', //上报后的状态
      signboard: '',
    }
  },
  created() {
    this.id = this.$route.query.salaryId
    this.year = this.$route.query.year
    this.month = this.$route.query.month
    this.type = this.$route.query.type
    this.projectId = this.$route.query.projectId
    this.projectName = this.$route.query.projectName
    this.wherePage = this.$route.query.wherePage
    this.showNotice = this.$route.query.showNotice
    this.signboard = this.$route.query.signboard
    if (this.$route.query.wherePage && this.$route.query.wherePage == 'fj') {
      // this.isShowBank = false;
      //   this.offerType = true;
      this.isShowBank = false
      this.isFj = true

      this.getPaywayList(this.id) //获取非建端  代发方式
    } else {
      // this.isShowBank = true;
      //   this.getPaypoundage();  //银联代发 手续费
      this.getInitPay() //获取建筑端代发方式
    }
    if (this.isFj) {
      this.getPaywayList(this.id)
    } else {
      this.OFFLINE = true
    }
    var pathname = window.location.pathname
    var ch = '/'
    this.pathname = pathname.replace(new RegExp(ch, 'g'), '')
  },
  methods: {
    /**
     * @description: 线上代发授权
     */
    onlineAgencyBtn() {
      const vm = this
      vm.axios({
        method: 'post',
        url: 'api-su/cs/salary/expand/bg',
        data: {
          salaryId: vm.id,
          sendType: 'ONLINE',
        },
      })
        .then((res) => {
          if (!res.data.hasError) {
            vm.onlineAgencyDate = res.data.result
            if (res.data.result.balance >= res.data.result.shouldPay) {
              vm.centerDialogVisible = true
            } else {
              vm.noDialogVisible = true
            }
          } else {
            this.$message({
              message: res.data.errorMsg,
              type: 'warning',
            })
          }
        })
        .catch((error) => {
          this.$message({
            showClose: true,
            duration: 3000,
            message: '线上代发失败',
            type: 'error',
          })
        })
    },
    getPaypoundage() {
      this.axios({
        method: 'post',
        url: 'api-su/cs/salary/expand/pd',
        data: {
          id: this.id,
          year: this.year,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              this.paypoundage = response.data.result
            } else {
              this.$message({
                message: response.data.errorMsg,
                type: 'warning',
              })
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
    updatesalarytype(sendType) {
      this.axios({
        method: 'post',
        // url: this.showNotice == 0 ? "api-su/cs/salary/expand/reportSalary":'api-su/cs/salary/expand/ustnew',
        url: 'api-su/cs/salary/expand/reportSalary',
        data: {
          id: this.id,
          sendType: sendType,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              //施工方（项目账号/企业账号）
              //当建设方审核或劳动监察审核开启时,页面提示目前开启的审核方
              let data = response.data.result
              this.sequenceCode = data.sequenceCode
              this.batchNo = data.batchNo
              //上报后工资表状态
              this.reportStatus = data.status
              //普通代发
              //   if (sendType == 'NORMAL') {
              //     this.commomPay();
              //   } else {
              //     //银行代发
              //     this.toPaySalary();
              //   }
              this.getConstructorSalaryResult(sendType)
            } else {
              this.$message({
                message: response.data.errorMsg,
                type: 'warning',
              })
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
    toReportSalary() {
      if (this.isEsUser()) {
        this.isCanPay()
        // if (this.$store.state.areaInfoArr.canPay == "1") {
        //恩施暂时无法代发
        //  this.$message({
        //       type: "error",
        //       message: "因代发银行的接口未按要求升级，暂无法代发"
        //   });
        //   return;
      } else {
        this.isNotEsPay()
      }
    },
    isNotEsPay() {
      var html =
        "<div style='font-size:16px'>请核对工资表的数据是否正确</div>" +
        '<div>1）上报后工资表将备案至监察和同步给银行</div>' +
        '<div>2）请核对工资表无误，' +
        "<span style='color:red'>您不能撤销上报</span></div>"
      this.$confirm(html, '普通代发', {
        dangerouslyUseHTMLString: true,
        confirmButtonText: '确认上报',
        cancelButtonText: '取消',
      })
        .then((action) => {
          this.updatesalarytype('NORMAL')
        })
        .catch(() => {})
    },
    /**
     * @description: 线上授权成功跳转
     */
    toAuthorize() {
      const vm = this
      vm.axios({
        method: 'post',
        url: 'api-su/cs/salary/expand/ustxs',
        data: {
          id: vm.id,
        },
      })
        .then((res) => {
          if (!res.data.hasError) {
            //施工方（项目账号/企业账号）
            //当建设方审核或劳动监察审核开启时,页面提示目前开启的审核方
            this.getConstructorSalaryResult()
            let data = res.data.result
            this.sequenceCode = data.sequenceCode
            this.batchNo = data.batchNo
            //上报后工资表状态
            this.reportStatus = data.status
            // this.$router.push({
            //   path: "/home/constructSalary/onlinePay",
            //   name: "onlinePay",
            //   query: {
            //     salaryId: this.$route.query.salaryId,
            //   }
            // });
            // this.$store.commit("CHANGE_SLIDER_NAME", { oldUrl: "/home/salaryDf/companySalaryBatchList", newUrl: this.$router.currentRoute.fullPath });
          } else {
            this.$message({
              message: res.data.errorMsg,
              type: 'warning',
            })
          }
        })
        .catch((error) => {
          this.$message({
            showClose: true,
            duration: 3000,
            message: '线上代发失败',
            type: 'error',
          })
        })
    },
    /**
     * @description: 线下代发跳转
     */
    toReportofflinePay() {
      this.isDisable = true
      const vm = this
      vm.axios({
        method: 'post',
        // url: this.showNotice == 0 ? "api-su/cs/salary/expand/reportSalary":'api-su/cs/salary/expand/ustnew',
        url: 'api-su/cs/salary/expand/reportSalary',
        data: {
          id: vm.id,
          sendType: 'OFFLINE',
        },
      })
        .then((res) => {
          if (!res.data.hasError) {
            //施工方（项目账号/企业账号）
            //当建设方审核或劳动监察审核开启时,页面提示目前开启的审核方
            this.getConstructorSalaryResult('OFFLINE')
            let data = res.data.result
            this.sequenceCode = data.sequenceCode
            this.batchNo = data.batchNo
            //上报后工资表状态
            this.reportStatus = data.status
            // this.$router.push({
            //   path: "/home/constructSalary/offlinePay",
            //   name: "offlinePay",
            //   query: {
            //     salaryId: this.$route.query.salaryId,
            //     sequenceCode: this.sequenceCode,
            //   }
            // });
            // this.$store.commit("CHANGE_SLIDER_NAME", { oldUrl: "/home/salaryDf/companySalaryBatchList", newUrl: this.$router.currentRoute.fullPath });
            this.isDisable = false
          } else {
            this.$message({
              message: res.data.errorMsg,
              type: 'warning',
            })
          }
        })
        .catch((error) => {
          this.$message({
            showClose: true,
            duration: 3000,
            message: '线上代发失败',
            type: 'error',
          })
        })
    },
    /**
     * @description: 非建线下代发跳转
     */
    fjToReportofflinePay() {
      var html =
        "<div style='font-size:16px'>请核对工资表的数据是否正确</div>" +
        '<div>1）上报后工资表将备案至监察和同步给银行</div>' +
        '<div>2）请核对工资表无误，' +
        "<span style='color:red'>您不能撤销上报</span></div>"
      this.$confirm(html, '线下授权', {
        dangerouslyUseHTMLString: true,
        confirmButtonText: '确认上报',
        cancelButtonText: '取消',
      })
        .then((action) => {
          this.fjToPay()
        })
        .catch(() => {})
    },
    fjToPay() {
      const vm = this
      vm.axios({
        method: 'post',
        url: 'api-su/salary/expand/ncust',
        data: {
          id: this.$route.query.salaryId,
          payType: 'OFFLINE',
        },
      })
        .then((res) => {
          if (!res.data.hasError) {
            this.sequenceCode = res.data.result.sequenceCode
            this.$router.push({
              path: '/home/constructSalary/offlinePay',
              name: 'offlinePay',
              query: {
                salaryId: this.$route.query.salaryId,
                sequenceCode: this.sequenceCode,
                ifFJ: true,
                wherePage: 'fj',
              },
            })
            this.$store.commit('CHANGE_SLIDER_NAME', {
              oldUrl: '/home/salary/qySalaryList',
              newUrl: this.$router.currentRoute.fullPath,
            })
          } else {
            this.$message({
              message: res.data.errorMsg,
              type: 'warning',
            })
          }
        })
        .catch((error) => {
          this.$message({
            showClose: true,
            duration: 3000,
            message: '线上代发失败',
            type: 'error',
          })
        })
    },
    commomPay() {
      this.$router.push({
        path: '/home/constructSalary/commomPay',
        name: 'commomPay',
        query: {
          projectId: this.$route.query.projectId,
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/salaryDf/companySalaryBatchList',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    isPay() {
      var html =
        "<div style='font-size:16px'>请核对工资表的数据是否正确</div>" +
        '<div>1）上报后工资表将备案至监察</div>' +
        '<div>2）银联代发需使用项目所属专户支付工资，否则会代发失败</div>' +
        '<div>3）企业使用银联代发需要与银联签署代发协议</div>'
      this.$confirm(html, '银联代发', {
        dangerouslyUseHTMLString: true,
        confirmButtonText: '确认上报',
        cancelButtonText: '取消',
      })
        .then((action) => {
          this.updatesalarytype('BANK')
        })
        .catch(() => {})
    },
    toPaySalary() {
      this.$router.push({
        path: '/home/constructSalary/constructPaySalary',
        name: 'constructPaySalary',
        query: {
          salaryId: this.id,
          month: this.month,
          year: this.year,
          projectId: this.$route.query.projectId,
          projectName: this.projectName,
          type: this.type,
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/salaryDf/companySalaryBatchList',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    toSalaryList() {
      if (this.$route.query.wherePage && this.$route.query.wherePage == 'fj') {
        this.$router.push('/home/salary/qySalaryList')
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/salary/qySalaryList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      } else {
        this.$router.push('/home/salaryDf/companySalaryBatchList')
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/salaryDf/companySalaryBatchList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    goBack() {
      if (this.$route.query.wherePage && this.$route.query.wherePage == 'fj') {
        this.$router.push({
          path: '/home/salary/editSalary',
          name: 'editSalary',
          query: {
            salaryId: this.id,
            year: this.year,
            month: this.month,
            type: this.type,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/salary/qySalaryList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      } else {
        if (this.signboard) {
          this.$router.push({
            path: '/home/constructSalary/editConstructSalary',
            name: 'editConstructSalary',
            query: {
              salaryId: this.id,
              month: this.month,
              year: this.year,
              projectId: this.$route.query.projectId,
              projectName: this.projectName,
              type: 'list',
              review: this.$route.query.review,
            },
          })
        } else {
          this.$router.push({
            path: '/home/constructSalary/editConstructSalary',
            name: 'editConstructSalary',
            query: {
              salaryId: this.id,
              month: this.month,
              year: this.year,
              projectId: this.$route.query.projectId,
              projectName: this.projectName,
              type: this.type,
            },
          })
        }
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/salaryDf/companySalaryBatchList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //  非建上报工资表
    fjToReportSalary() {
      var html =
        "<div style='font-size:16px'>请核对工资表的数据是否正确</div>" +
        '<div>1）上报后工资表将备案至监察和同步给银行</div>' +
        '<div>2）请核对工资表无误，' +
        "<span style='color:red'>您不能撤销上报</span></div>"
      this.$confirm(html, '普通代发', {
        dangerouslyUseHTMLString: true,
        confirmButtonText: '确认上报',
        cancelButtonText: '取消',
      })
        .then((action) => {
          this.fjUpdatesalarytype('NORMAL')
        })
        .catch(() => {})
    },
    fjUpdatesalarytype(sendType) {
      this.axios({
        method: 'post',
        url: 'api-su/salary/expand/ust',
        data: {
          id: this.id,
          sendType: sendType,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              //普通代发
              if (sendType == 'NORMAL') {
                this.fjCommomPay()
              }
            } else {
              this.$message({
                message: response.data.errorMsg,
                type: 'warning',
              })
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
    fjCommomPay() {
      this.$router.push({
        path: '/home/constructSalary/commomPay',
        name: 'commomPay',
        query: {
          wherePage: 'fj',
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/salary/qySalaryList',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    //建筑端 代发方式v1.1.5
    getInitPay() {
      this.axios({
        method: 'post',
        // url: "api-su/cs/salary/expand/findAgencyTypeByProject",
        url: 'api-m/paramconfig/agencyTypeByProject',
        data: {
          projectId: this.projectId,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              this.offerType = response.data.result.offerType
              this.onlineType = response.data.result.onlineType
              this.offlineType = response.data.result.offlineType
              this.unionType = response.data.result.unionType
            } else {
              this.$message({
                type: 'error',
                message: response.data.errorMsg,
              })
            }
          },
          (response) => {}
        )
        .catch((error) => {
          console.log(error)
        })
    },
    isCanPay() {
      this.axios({
        method: 'post',
        url: 'api-f/onstage/get',
        data: {
          type: this.pathname,
        },
      }).then(
        (response) => {
          if (!response.data.hasError) {
            if (response.data.result.canPay == '0') {
              //恩施暂时无法代发
              this.$message({
                type: 'error',
                message: '因代发银行的接口未按要求升级，暂无法代发',
              })
              return
            } else {
              this.isNotEsPay()
            }
          }
        },
        (response) => {}
      )
    },
    /**
     * @name: 上报工资表后选择线上授权代发还是线下授权代发 2020-11-18
     * @param {salaryId} string 工资表id
     * @Author: luoyong/471826078@qq.com
     */
    getPaywayList(salaryId) {
      const vm = this
      vm.axios
        .post('api-su/salary/expand/paywaylist', { salaryId })
        .then((res) => {
          if (!res.data.hasError) {
            if (res.data.msg) {
              vm.tipMsg = res.data.msg
            }
            const { ONLINE, OFFLINE } = res.data.result
            vm.ONLINE = ONLINE == 'OFF' ? false : true
            vm.OFFLINE = OFFLINE == 'OFF' ? false : true
          } else {
            this.$message({
              type: 'error',
              message: res.data.errorMsg,
            })
          }
        })
    },
    getConstructorSalaryResult(sendType) {
      this.axios({
        method: 'post',
        url: 'api-su/cs/salary/expand/getCsSalaryCheckConfig',
        data: {
          salaryId: this.id,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              var data = response.data.result
              if (data) {
                this.checkOperator = response.data.result
                this.$router.push({
                  path: '/home/constructSalary/constructorSalaryResult',
                  name: 'constructorSalaryResult',
                  query: {
                    salaryId: this.id,
                    yearQuery: this.year,
                    monthQuery: this.month,
                    batchNo: this.batchNo,
                    checkOperator: this.checkOperator,
                    reportStatus: this.reportStatus,
                    projectId: this.projectId,
                  },
                })
                this.$store.commit('CHANGE_SLIDER_NAME', {
                  oldUrl: '/home/salaryDf/companySalaryBatchList',
                  newUrl: this.$router.currentRoute.fullPath,
                })
              } else {
                if (sendType == 'NORMAL') {
                  //普通代发
                  this.commomPay()
                } else if (sendType == 'BANK') {
                  //银行代发
                  this.toPaySalary()
                } else {
                  //线下代发
                  this.$router.push({
                    path: '/home/constructSalary/offlinePay',
                    name: 'offlinePay',
                    query: {
                      salaryId: this.id,
                      sequenceCode: this.sequenceCode,
                    },
                  })
                  this.$store.commit('CHANGE_SLIDER_NAME', {
                    oldUrl: '/home/salaryDf/companySalaryBatchList',
                    newUrl: this.$router.currentRoute.fullPath,
                  })
                }
              }
            } else {
              this.$message({
                message: response.data.errorMsg,
                type: 'warning',
              })
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
  },
}
</script>

<style scoped lang="less">
.mainCon {
  min-height: calc(100% - 67px);
}

// 生成方式
.createWayBox {
  margin-top: 40px;
  text-align: center;
  margin-bottom: 0;
  // padding-bottom: 70px;
  p {
    font-size: 28px;
    color: #333;
    font-family: '宋体';
    margin-bottom: 40px;
  }

  ul {
    display: inline-block;
    max-width: 918px;
    li {
      // width: 417px;
      width: 435px;
      padding: 24px;
      margin: 0 auto;
      background-color: #f5f7fb;
      margin-bottom: 24px;
      margin-left: 12px;
      margin-right: 12px;
      float: left;
      .title {
        // font-family: SourceHanSansCN-Regular;
        font-size: 24px;
        color: #009588;
      }
      .explainBox {
        font-size: 14px;
        color: #666666;
        margin: 24px 0;
        .red {
          font-size: 16px;
          color: #e02020;
        }
      }
    }
  }
  ul li {
    background: url('../../../static/img/salary/free.png') no-repeat;
    background-size: 100% 100%;
  }

  ul .chargeBox {
    background: url('../../../static/img/salary/charge.png') no-repeat;
    background-size: 100% 100%;
  }

  ul .freeBox .explainBox {
    margin: 35px 0;
  }
}

.successIcon {
  font-size: 79.9px;
  color: green;
}
.warningIcon {
  font-size: 79.9px;
  color: #ffaa00;
}
/deep/ .el-dialog__header {
  padding: 0 !important;
  border-bottom: 0px;
}
/deep/ .dialog-footer {
  text-align: right;
}
.successContent {
  text-align: center;
  font-size: 14px;
  p {
    span {
      color: #009588;
    }
  }
}
.payAbleList {
  margin-top: 24.1px;
  font-family: SourceHanSansCN-Regular;
  font-size: 16px;
  color: #666666;
  text-align: center;
  line-height: 24px;
}
.accountBalance {
  font-family: SourceHanSansCN-Regular;
  font-size: 16px;
  color: #666666;
  text-align: center;
  line-height: 24px;
}
.balance-tip {
  margin-top: 10px;
  font-family: SourceHanSansCN-Regular;
  font-size: 14px;
  color: #e02020;
}
.accountBalance-tip {
  margin-top: 10px;
  font-family: SourceHanSansCN-Regular;
  font-size: 14px;
  color: #666666;
  text-align: center;
}
.icontip {
  font-size: 36px;
  color: #ed930a;
}
</style>
